package fileSystem;
import java.util.*;
import java.text.SimpleDateFormat;
public class MyFileSystem
{
	public static void main(String[] args) 
	{	
		String s1="C:\\Users\\Administrator";
		System.out.printf("%s>",s1);
		SimpleDateFormat matter=new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒(a)(EE)");
		while(true){
			
			String s2=new String();
			
			Scanner reader=new Scanner(System.in);
			s2=reader.nextLine();
			FileSystem dir=new FileSystem();
		
			if(s2.startsWith("cd")){
				if(s2.startsWith("cd..")){
					s1=dir.returnParent(s1);
					System.out.printf("%s>",s1);
					}
				else{
					s1=dir.changePath(s2,s1);
					System.out.printf("%s>",s1);
				}
			}
			
			else if(s2.startsWith("copy")){
				dir.fileCopy(dir.f(s2),s1);
				System.out.printf("%s>",s1);
			}
			else if(s2.startsWith("paste")){
				dir.filePaste(s1);
				System.out.printf("%s>",s1);
			}
			else if(s2.startsWith("cat")){
				dir.fileLook(dir.f(s2),s1);
				System.out.printf("%s>",s1);
			}
			else if(s2.startsWith("del")){
				dir.fileDelete(dir.f(s2),s1);
				System.out.printf("%s>",s1);
			}
			else if(s2.startsWith("md")){
				dir.createDir(dir.f(s2),s1);
				System.out.printf("%s>",s1);
			}
			else if(s2.startsWith("dir")){
				dir.showDir(s1);
				System.out.println("\n");
				System.out.printf("%s>",s1);
			}
			else if(s2.startsWith("mkdir")){
				dir.createFile(s1,dir.f(s2));
				System.out.printf("%s>",s1);
			}
			else if(s2.startsWith("run")){
				dir.runFile(dir.f(s2),s1);
				System.out.printf("%s>",s1);
			}
			else if(s2.length()==2&&s2.endsWith(":")){
				s1=s2;
				System.out.printf("%s>",s1);
			}
			else if(s2.equals("time")){
				System.out.println("北京标准时间："+matter.format(new Date()));
			}
			else if(s2.equals("exit")){
				System.exit(0);
			}
			else if(s2.equals("help")){
				System.out.println("cd           显示当前目录的名称或将其更改");
				System.out.println("copy         复制文件到剪切板");
				System.out.println("paste        粘贴剪贴板的文件到所选目录");
				System.out.println("time         显示当前时间");
				System.out.println("del          删除所选文件");
				System.out.println("dir          显示一个目录的文件和子目录");
				System.out.println("help         显示帮助文档");
				System.out.println("md			   创建一个目录");
				System.out.println("mkdir        创建一个文件");
				System.out.println("help         显示帮助文档");
				System.out.println("run          运行可执行文件");
				System.out.println("cat          查看文件");
				System.out.println("exit         退出文件系统");
			}
		}
	}
}
